package com.uchonor.api.core.service;

import com.uchonor.api.core.query.DbType;
import com.uchonor.olight.agent.annotation.Service;
import org.apache.commons.lang3.StringUtils;

@Service
public class PostgreDataSourceMetaDataStrategy extends AbsDataSourceMetaDataStrategy {
    @Override
    protected DbType getSupperDbType() {
        return DbType.POSTGRE_SQL;
    }

    @Override
    protected String buildTableSql(String tableSchema) {
        if(StringUtils.isBlank(tableSchema)){
            tableSchema = "public";
        }
        return String.format(getDbQuery().tablesSql(), tableSchema);
    }

    @Override
    protected String getFiledSql(String tableName,String tableSchema){
        return String.format(getDbQuery().tableFieldsSql(), tableSchema, tableName);
    }
}
